<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<script type="text/javascript">
/**
 * Get the HTML form.
 * @param namespace
 * @param frmName
 * @return
 */
function getForm(namespace, frmName) {
  return document.forms[namespace + frmName];
}

/**
 * Submit the form.
 * @param namespace
 * @param frmName
 * @param eventId
 * @return
 */
function submitAction(namespace, frmName, eventId, dictId) {
  var frm = getForm(namespace, frmName);
  frm.eventId.value = eventId;
  frm.dictId.value = dictId;
  frm.submit();
}

</script>
<portlet:defineObjects />

<form action="<portlet:actionURL/>" name="<portlet:namespace/>ApproverHome" method="post">
<input name="eventId" type="hidden" />
<input name="dictId" type="hidden"/>
<input name="screenId" type="hidden" value="approverhome"/>
<table style="width:100%;background:#FF9">
<tr>
			<td colspan="3" style="width:100%;height:50px;background:#0F3">
            Hello ${sessionScope.username}
            <div style="float:right"><input type="submit" value="Home" onclick='submitAction("<portlet:namespace/>", "ApproverHome", "home", "0");'/></div>
            <div style="float:right"><input type="submit" value="Logout" onclick='submitAction("<portlet:namespace/>", "ApproverHome", "logout", "0");'/></div>
            </td>
      	</tr>
<tr>
<td colspan="3" align="center"><font color="#00FF00" size="+6">Approver Homepage</font></td>
</tr>
<tr>
    <td colspan="3">
    	<table width="100%">
        	<tr>
            	<td width="33%" align="center"><font size="+2">Dictionary</font></td>
			    <td width="41%" align="center"><font size="+2">Statistics</font></td>
			    <td width="26%" align="center"><font size="+2">Checking</font></td>
            </tr>
        </table>
    </td>
</tr>
<c:forEach var="item" items="${result.listDictionaries }">
	<tr>
		<td width="36%" align="center">${item.dictName }</td>
		<td width="64%" colspan="2">
	    	<table width="100%">
	        	<tr>
	            	<td align="center" width="40%">New Word Suggested</td>
	                <td align="center" width="22%" style="color:#F00">${item.newWordCount }</td>
	                <td align="center" width="38%"><input type="submit" value="Check Suggestion" style="width:100%" onclick='submitAction("<portlet:namespace/>", "ApproverHome", "checksuggestion", "${item.dictID }");'/></td>
	            </tr>
	            <tr>
	            	<td align="center">Reviewer Checking</td>
	                <td>
	                	<table width="100%">
	                    	<c:forEach var="reviewer" items="${item.listReviewer }">
	                    		<tr>
	                        		<td align="center">${reviewer.username }</td>
	                        	</tr>
	                    	</c:forEach>
	                    </table>
	                </td>
	                <td><input type="submit" value="Reviewer Detail" style="width:100%" onclick='submitAction("<portlet:namespace/>", "ApproverHome", "reviewerdetail", "${item.dictID }");'/></td>
	            </tr>
	        </table>
	    </td>
	</tr>	
</c:forEach>
</table>
</form>